package org.example.demo;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum Direction {
    R("右"),
    U("上"),
    D("下"),
    L("左");

    private String name;

    public boolean isUp(){
        return this.equals(Direction.U);
    }
    public boolean isDown(){
        return this.equals(Direction.D);
    }
    public boolean isLeft(){
        return this.equals(Direction.L);
    }
    public boolean isRight(){
        return this.equals(Direction.R);
    }

    public boolean isMutex(Direction direction) {
        return (this.isUp() && direction.isDown()) ||
                (this.isDown() && direction.isUp()) ||
                (this.isLeft() && direction.isRight()) ||
                (this.isRight() && direction.isLeft());
    }
}
